package com.kaili.basic.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.kaili.basic.pojo.dto.MdmParamDto;
import com.kaili.basic.pojo.vo.MdmParamVo;
import com.kaili.common.util.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.kaili.basic.pojo.entity.MdmParamEntity;
import com.kaili.basic.service.IParamService ;
import com.kaili.basic.mapper.ParamMapper;

import java.util.HashMap;
import java.util.List;

/**
*  service实现类
* @author:liuyang
* @Time: 2019-07-24
* @Copyright: ©  杭州凯立通信有限公司 版权所有
* @Warning: 本内容仅限于公司内部传阅,禁止外泄或用于其它商业目的
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class ParamServiceImpl extends ServiceImpl<ParamMapper, MdmParamEntity>  implements IParamService {

    @Override
    public Page<MdmParamVo> queryPageList(Page<MdmParamVo> page, MdmParamDto dto) {
        return page.setRecords(baseMapper.queryPageList(page, ObjectUtils.objectToMap(dto)));

    }

    @Override
    public MdmParamVo queryById(Integer id) {
        List<MdmParamVo> list = baseMapper.queryPageList(new HashMap<String, Object>(2) {{put("id", id);}});
        if(list !=null && list.size()>0){
            return list.get(0);
        }

        return null;
    }


}
